/**
 * 
 * If you have edited the file, please update
 * all the last-modified fields manually. Thanks!
 *
 * @last-modified by: 
 * @last-modified date: 
 * @last-modified time: 
 *
 * @author Swee Zhi
 * @date-created Sep 5, 2011    @time-created 8:35:57 PM
 *
 * @project: 
 * @module: 
 * @institution: 
 *
 */
package entity;

import java.io.Serializable;
import java.sql.Time;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import util.enumeration.ActivityType;
import util.enumeration.TransportType;

@Entity(name="ItinerarySlot")
public class ItinerarySlotEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    // standard itinerary details
//    private ActivityType activityType;
    private String entityName; // where to draw information from
    private String dType; // which sub-class does it belong to
    private Long itemKey; // primary id of stakeholder or attraction or any other activity
    private Time startTime;
    private Time endTime;
   
    private String activityName;
    private ActivityType activityType;
    private TransportType transportType;
    
    @ManyToOne
    private DailyItineraryEntity dailyItinerary = new DailyItineraryEntity();
    
    
    public ItinerarySlotEntity() {
        
    }
    
    public void create(String entityName, String dType,
                       Long itemKey, 
                       Time startTime, Time endTime,
                       String activityName,
                       ActivityType activityType) {
        this.setEntityName(entityName);
        this.setdType(dType);
        this.setItemKey(itemKey);
        this.setStartTime(startTime);
        this.setEndTime(endTime);
        this.setActivityName(activityName);
        this.setActivityType(activityType);
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getItemKey() {
        return itemKey;
    }

    public void setItemKey(Long itemKey) {
        this.itemKey = itemKey;
    }

    public Time getEndTime() {
        return endTime;
    }

    public void setEndTime(Time endTime) {
        this.endTime = endTime;
    }

    public Time getStartTime() {
        return startTime;
    }

    public void setStartTime(Time startTime) {
        this.startTime = startTime;
    }

    public ActivityType getActivityType() {
        return activityType;
    }

    public void setActivityType(ActivityType activityType) {
        this.activityType = activityType;
    }

    public String getEntityName() {
        return entityName;
    }

    public void setEntityName(String entityName) {
        this.entityName = entityName;
    }

    public TransportType getTransportType() {
        return transportType;
    }

    public void setTransportType(TransportType transportType) {
        this.transportType = transportType;
    }

    public String getdType() {
        return dType;
    }

    public void setdType(String dType) {
        this.dType = dType;
    }

    public DailyItineraryEntity getDailyItinerary() {
        return dailyItinerary;
    }

    public void setDailyItinerary(DailyItineraryEntity dailyItinerary) {
        this.dailyItinerary = dailyItinerary;
    }

    public String getActivityName() {
        return activityName;
    }

    public void setActivityName(String activityName) {
        this.activityName = activityName;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ItinerarySlotEntity)) {
            return false;
        }
        ItinerarySlotEntity other = (ItinerarySlotEntity) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "common.entity.itinerary.ItinerarySlotEntity[ id=" + id + " ]";
    }
    
}
